import {messages} from "share/common";
import React from 'react'
import { Tabs } from 'antd'
import Condition from 'components/condition'
import EntryDetail from 'containers/financial-management/entry-infomation/entry-detail'
import ExportDownload from 'containers/financial-management/entry-infomation/export-download'
const If = Condition.If;
const TabPane = Tabs.TabPane;

class EntryInformation extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      status: 'entry-detail',
      tabs: [
        { key: 'entry-detail', name: messages('financial-management.key844')/*分录信息*/ },
        { key: 'export-download', name: messages('financial-management.key845')/*导出批次下载*/ }
      ],
    }
  }

  onChangeTabs = value => {
    this.setState({ status: value });
  };

  render() {
    const { status, tabs } = this.state;
    return (
      <div>
        <Tabs type="card" onChange={this.onChangeTabs} activeKey={status}>
          {
            tabs.map(item => {
              return <TabPane tab={item.name} key={item.key}/>;
            })
          }
        </Tabs>
        <If value={status === 'entry-detail'}>
          <EntryDetail makeBatchDone={() => this.onChangeTabs('export-download')}/>
        </If>
        <If value={status === 'export-download'}>
          <ExportDownload/>
        </If>
      </div>
    )
  }
}

export default EntryInformation;
